//
//  JrdCourseChpaterCellTableViewCell.m
//  v2ex-iOS
//
//  Created by longcheng on 16/5/21.
//  Copyright © 2016年 Singro. All rights reserved.
//

#import "JrdCourseChpaterCellTableViewCell.h"
#import "JrdCommon.h"
#import "JrdNodeModel.h"
#import "JrdChapterModel.h"
@interface JrdCourseChpaterCellTableViewCell(){
    UIImageView *_imageView;
    UILabel *_classNameLabel;/**< 课程名 */
    UILabel *_classHourseLabel;/**< 课程时长 */
}
@property (nonatomic, strong) JrdNodeModel* chapterModel;
@property (nonatomic, strong) JrdChapterModel* chapterModelExt;

@end
@implementation JrdCourseChpaterCellTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(16, 0, 1, 64)];
        lineView.backgroundColor = JRD_RGB(219, 52, 50);
        //[self addSubview:lineView];
        
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, (64- 30)/2, 30, 30)];
        _imageView.image = [UIImage imageNamed:@"lesson_default"];
        [self addSubview:_imageView];
        //课程名
        _classNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 5, SCREEN_WIDTH-10-50, 30)];
        _classNameLabel.font = [UIFont systemFontOfSize:15];
        [self addSubview:_classNameLabel];
        //课程时长
        _classHourseLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 30, SCREEN_WIDTH-10-50, 30)];
        _classHourseLabel.textColor = [UIColor lightGrayColor];
        _classHourseLabel.font = [UIFont systemFontOfSize:13];
        [self addSubview:_classHourseLabel];
    }
    return self;
}


-(void)setJzClassM:(JrdNodeModel *)jzClassM{
    _chapterModel = jzClassM;
    _classNameLabel.text = [NSString stringWithFormat:@"%@",(long)jzClassM.NodeIndex,jzClassM.NodeName];
    
    //int length = [jzClassM.NodeDuration long];
    _classHourseLabel.text = [NSString stringWithFormat:@"课程时长：%lld分钟",jzClassM.NodeDuration/60];
}


-(void)setJzClassMExt:(JrdChapterModel *)jzClassM{
    _chapterModelExt = jzClassM;
    _classNameLabel.text = [NSString stringWithFormat:@"第%@章:%@",jzClassM.ChapterIndex,jzClassM.ChapterName];
    
    //int length = [jzClassM.NodeDuration intValue];
    _classHourseLabel.text = [NSString stringWithFormat:@"课时%@", jzClassM.ChapterNodeNum];
}

@end
